package ch00.ch02;

/**
 * @Author lzp
 * @Date 2024-04-02
 */
public class Sum {
    private int n;

    public Sum() {
    }

    public Sum(int n) {
        this.n = n;
    }

    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
    }

    public static int getSum(@Max(value=100) int n) {
        int sum = 0;
        int value;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        System.out.println("1到n的和为：" + sum);
        return sum;
    }
}
